package com.yang.ddz.serviceimpl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yang.ddz.mapper.UserMapper;
import com.yang.ddz.data.User;
import com.yang.ddz.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

// 增删改查的逻辑
@Service("userService")
public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements UserService {

    @Autowired
    private UserMapper userMapper;

    public User getByPlayerId(Integer pid) {
        return userMapper.selectById(pid);
    }


    public boolean setPlayer(Integer pid) {
        User newuser = new User();
        newuser.setPlayerId(pid);
        newuser.setPlayerName("test");
        Integer value = userMapper.insert(newuser);
        return value == 1;
    }
}
